package com.qingke.test;

public class Rectangle {
	float length = 1.0f;
	float  width = 1.0f;
	public Rectangle(){
		
	}
	public Rectangle(float length,float width){
		this.length=length>0?length:1;
		this.width=width>0?width:1;
	}
	public float getLength() {
		return length;
	}
	public void setLength(float length) {
		if(length>0)
			this.length = length;
	}
	public float getWidth() {
		return width;
	}
	public void setWidth(float width) {
		if(width>0)
			this.width = width;
	}
	public float getArea() {
		return length*width;
	}
	public float getPerimeter() {
		return length+length+width+width;
	}
	public String toString() {
		return "Rectangle[length="+length+",width="+width+"]";
	}
}
